#include "playlistPainter.h"
#include "QVariant"

PlaylistPainter::PlaylistPainter() :
   ActionListPainter()
{
}


void PlaylistPainter::paintItem( const QRect &draw_area,
                                 const QVariant &displayData,
                                 int position)
{
   QTextOption txt_opt;
   txt_opt.setWrapMode( QTextOption::NoWrap );

   QString displayText = displayData.toString();
   painter()->drawText( draw_area.adjusted(5,0, 0, 0),
                        formatDisplayText( position, displayText ), txt_opt );
}

/**
 * @param position - item list number (1 based)
 * @param displayText - base name of full media path
 * @return  text to show in view.
 */
QString PlaylistPainter::formatDisplayText( int position, const QString &displayText )
{
   return QString( "[%1] - %2" ).arg(position + 1).arg(displayText);
}
